package 设计模式.factor.pizza.order;

import 设计模式.factor.pizza.pizza.CheesePizza;
import 设计模式.factor.pizza.pizza.GreekPizza;
import 设计模式.factor.pizza.pizza.Pizza;

public class SimpleFactory {
    public Pizza createPizza(String orderType){
        Pizza pizza=null;
        System.out.println("简单工厂");
        if (orderType.equals("greek")){
            pizza=new GreekPizza();
            pizza.setName("希腊");
        }else if (orderType.equals("cheese")){
            pizza=new CheesePizza();
            pizza.setName("奶酪");
        }
        return pizza;
    }
}
